package cn.com.lyj6851.common.validate.image;

import javax.imageio.ImageIO;

import org.springframework.stereotype.Component;
import org.springframework.web.context.request.ServletWebRequest;

import cn.com.lyj6851.common.validate.AbstractValidateCodeProcessor;

/**
 * 图片验证码发送
 */
@Component
public class ImageValidateCodeProcessor extends AbstractValidateCodeProcessor<ImageCode>{

	/**
     * 发送图形验证码，将其写到响应中
     */
	@Override
	protected void send(ServletWebRequest request, ImageCode validateCode) throws Exception {
		ImageIO.write(validateCode.getImage(), "JPEG", request.getResponse().getOutputStream());
	}

}
